package com.bw.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author bobo棒
 * @date 2024年06月27日 11:32
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R implements Serializable {
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 消息
     */

    private String msg;


    /**
     * 数据
     */
    private Object data;

    public static R success(){
        return new R(200,"成功",null);
    }

    public static R success(String msg,Object  data){
        return new R(200,msg,null);
    }
    public static R success(Object  data){
        return new R(200,"成功",data);
    }

    public static R error(){
        return new R(500,"失败",null);
    }

    public static R error(String msg){
        return new R(500,msg,null);
    }


}
